#include <QtGui/QApplication>
#include <QTranslator>
#include <QResource>
#include <QLocale>
#include <QSettings>

#include "mainuiloader.h"

#include <QDebug>
#include <QStyleFactory>

//Password saved in passwd.h
//change filename in mainuiloader.cpp

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QLocale::setDefault(QLocale(
        QLocale::Chinese,QLocale::China)
    );

    QTranslator ts;
    QResource qm("zh_CN.qm");

    if(qm.isCompressed())
    {
        QByteArray s = qUncompress(qm.data(),qm.size());
        ts.load((uchar*)s.data(),s.size());
    }
    else
    {
        ts.load(qm.data(),qm.size());
    }
    a.installTranslator(&ts);

    QSettings cfg("IgnitionPanel.ini",QSettings::IniFormat);
    cfg.setIniCodec("UTF-8");
    a.setStyle(cfg.value("Application/style").toString());

    //qDebug() << QStyleFactory::keys();

    MainUILoader w;
    w.hide();

    return a.exec();
}
